package com.kingdee.eas.custom.hr.attendance.app;

import org.apache.log4j.Logger;
import javax.ejb.*;
import java.rmi.RemoteException;
import com.kingdee.bos.*;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.metadata.IMetaDataPK;
import com.kingdee.bos.metadata.rule.RuleExecutor;
import com.kingdee.bos.metadata.MetaDataPK;
//import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
//import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.dao.IObjectCollection;
import com.kingdee.bos.service.ServiceContext;
import com.kingdee.bos.service.IServiceContext;

import java.lang.String;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.eas.custom.hr.attendance.AttendanceDataLogInfo;
import com.kingdee.eas.custom.hr.attendance.AttendanceRecordCollection;
import com.kingdee.eas.custom.hr.attendance.AttendanceRecordInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.framework.app.ObjectBaseControllerBean;
import com.kingdee.eas.custom.hr.attendance.AttendanceDataLogCollection;
import com.kingdee.eas.framework.CoreBaseInfo;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;

import com.kingdee.eas.framework.ObjectBaseCollection;
import java.util.List;

public class AttendanceDataLogControllerBean extends AbstractAttendanceDataLogControllerBean
{
    private static Logger logger =
        Logger.getLogger("com.kingdee.eas.custom.hr.attendance.app.AttendanceDataLogControllerBean");

	@Override
	protected void _saveAttendanceDataLog(Context ctx,
			IObjectValue attendanceDataLog) throws BOSException,
			EASBizException {


		Set addSet = (Set) attendanceDataLog.get("addSet");
		Set updateSet = (Set) attendanceDataLog.get("updateSet");
		Set deleteSet = (Set) attendanceDataLog.get("deleteSet");

		Iterator it = addSet.iterator();
		AttendanceDataLogInfo info = null;

		AttendanceDataLogCollection colls = new AttendanceDataLogCollection();
		while (it.hasNext()) {
			info = (AttendanceDataLogInfo) it.next();
			colls.add(info);
		}
		this._saveBatchData(ctx, colls);

		IObjectPK[] pks = new ObjectUuidPK[deleteSet.size()];
		int i = 0;
		it = deleteSet.iterator();
		while (it.hasNext()) {
			info = (AttendanceDataLogInfo) it.next();
			pks[i++] = new ObjectUuidPK(info.getId());
		}
		this.deleteBatchData(ctx, pks);

		CoreBaseCollection collection = new CoreBaseCollection();
		it = updateSet.iterator();
		while (it.hasNext()) {
			info = (AttendanceDataLogInfo) it.next();
			collection.add(info);
		}

		this.updateBatchData(ctx, collection);
	
	}
}